Skip to content

feat(eap): Add wildcard search support for array string attributes#7770

Open
phacops wants to merge 6 commits intomasterfrom
pierre/eap-array-wildcard-search
Open

feat(eap): Add wildcard search support for array string attributes#7770
phacops wants to merge 6 commits intomasterfrom
pierre/eap-array-wildcard-search

Conversation

@phacops
Copy link
Contributor

@phacops phacops commented Feb 25, 2026

Summary

  • Add TYPE_ARRAY handling in attribute_key_to_expression using DangerousRawSQL to extract string values from the JSON attributes_array column
  • Extend OP_LIKE/OP_NOT_LIKE filter translation to support TYPE_ARRAY keys via arrayExists with a lambda
  • LIKE on arrays: arrayExists(x -> like(x, pattern), array) — true if any element matches
  • NOT_LIKE on arrays: NOT(arrayExists(x -> like(x, pattern), array)) — true if no element matches
  • Both support ignore_case flag (switches likeilike)

Test plan

  • Unit tests for attribute_key_to_expression with TYPE_ARRAY (expression shape, alias, backtick escaping)
  • Unit tests for LIKE/NOT_LIKE on array keys (case-sensitive, case-insensitive, NOT variants)
  • Unit tests verifying LIKE/NOT_LIKE on non-string/non-array types still raises errors
  • All pre-commit hooks pass (ruff format, ruff lint, mypy)

🤖 Generated with Claude Code

Agent transcript: https://claudescope.sentry.dev/share/CSlg1g-5P5OFoOJQo-B83K2SA1OibDF7tSh1ralLTgs

@phacops phacops requested review from a team as code owners February 25, 2026 19:51
Copy link
Member

@volokluev volokluev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be a test of the API actually doing stuff, not just the query generation

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

@phacops phacops requested a review from volokluev February 26, 2026 23:35
Support LIKE/NOT_LIKE operations on TYPE_ARRAY attribute keys in the EAP
RPC filter layer. This enables searching for rows where any element in an
array attribute matches a wildcard pattern (e.g. `%error%`).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Agent transcript: https://claudescope.sentry.dev/share/MPMg6cd5C44sTcO2w7G21dFgr2ROlgzLl2IsE6tXT_M
…ession

Address review feedback: instead of adding TYPE_ARRAY handling to the
shared attribute_key_to_expression function, build the array extraction
expression directly in the filter code where it's needed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Agent transcript: https://claudescope.sentry.dev/share/pjQ2FphvcZ1pKVc4nPolPe74-FfTxXiVaeKc5q4XyME
Handle TYPE_ARRAY as an early return in comparison filter processing
so unsupported operations (EQUALS, IN, etc.) raise immediately instead
of producing invalid SQL. Add test for this error path.

Co-Authored-By: Claude <noreply@anthropic.com>

Agent transcript: https://claudescope.sentry.dev/share/hhni4eW0BB_sX1hx1k3ocFkKDVAR5tFkoNu10Z-uERw
Add check that the comparison value is a string before using val_str
for TYPE_ARRAY LIKE/NOT_LIKE operations. Without this, a non-string
value silently defaults to an empty string pattern.

Co-Authored-By: Claude <noreply@anthropic.com>

Agent transcript: https://claudescope.sentry.dev/share/H-XBt-koklI88xXMMmB8rnyAuP-g8fRDyDXx9KD7YI4
Add end-to-end tests demonstrating LIKE and NOT_LIKE filters on
TYPE_ARRAY attributes, verifying that items with matching array
elements are correctly included/excluded.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Agent transcript: https://claudescope.sentry.dev/share/jlBT3oyR1enG1rD_up18ROqoFcmPcj0MGTgsEhptGec
Update test assertion to check for FunctionCall instead of
DangerousRawSQL, matching the rebased implementation that uses
JsonPath DSL via attribute_key_to_expression.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Agent transcript: https://claudescope.sentry.dev/share/PUQy8YbxsajMsffTOp8W_J6aEJ2PVDa9U_b0bmqdRWU
@phacops phacops force-pushed the pierre/eap-array-wildcard-search branch from 43cf76e to 08a4591 Compare February 26, 2026 23:59
Copy link
Member

@volokluev volokluev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wow so much simpler.

nit but the PR description is incorrect now, maybe make the robot regenerate it (or delete it)

@xurui-c xurui-c self-requested a review February 27, 2026 20:18
Copy link
Member

@xurui-c xurui-c left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking, happy to merge as-is. Nit: I feel like the validations can be grouped together to line 228 and reduce the repetition at line 301 and line 322

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants